package dFS;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/*

以6为例
6
5+1
4+2, 4+1+1
3+3, 3+2+1, 3+1+1+1
2+2+2, 2+2+1+1, 2+1+1+1+1
1+1+1+1+1+1

观察式子和标准答案代码可得规律：
1、每行都有一个最大值i引出式子i+(n-i)，n-i如果大于i，那么需要继续分，如果比1大，那么也还需要继续分
2、对于每行最大值i引出的式子，最多有n-i+1个式子，比如i = 6只有1个式子，i = 5则是也是1个式子，i = 4可以有2个，i = 3有3个


 */

public class IntegerDivision {
    static InOut1 io = new InOut1();
    int n;
    int[] arr;

    public IntegerDivision() throws IOException {
        n = io.nextInt();
        arr = new int[n];
        divide(n, 0);
    }

    /*
    
    
    6     5         4           3             2             1
         /         / \         /|\           / \            |
        1         2   1       3 2 1         2   1           1
                       \        |  \       / \   \          |
                        1       1   1     2   1   1         1
                                     \         \   \        1
                                      1         1   1       |
                                                     \      1
                                                      1     |
                                                            1
    
     */
    private void divide(int i, int k) {
        // TODO Auto-generated method stub
        // 出口
        if (i <= 0) {
            for (int j = 0; j < k; j++) {
                if (j != 0) {
                    io.out.print(" + ");
                }
                io.out.print(arr[j]);
            }
            io.out.println();
            return;
        }

        // 相似性
        for (int j = i; j > 0; j--) {// j=6,5,4,3,2,1 循环6次
            if (k > 0 && j > arr[k - 1])
                continue;// 确保数字由大到小
            arr[k] = j;// 数组下标为k的元素
            io.out.println(Arrays.toString(arr));
            divide(i - j, k + 1);
            
            // 6...f(0) 5...f(1) 4...f(2)
            // i...f(n-i)
        }
    }

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        IntegerDivision i = new IntegerDivision();
        io.out.flush();
    }

}

class InOut1 {
    BufferedReader br;
    StringTokenizer tok;
    PrintWriter out;

    public InOut1() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
    }
    
    public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                // TODO Auto-generated catch block
                return false;
            }
        }
        return true;
    }
    public String next() {
        if (hasNext()) {
            return tok.nextToken();
        }
        return null;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
}
